package comm.suger.web.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import comm.suger.web.model.dao.SysUserDao;
import comm.suger.web.model.entity.SysUser;
import comm.suger.web.service.SysUserService;

@Transactional(readOnly = true)
@Service(value = "sysUserService")
public class SysUserServiceImpl implements SysUserService {

	@Autowired
	private SysUserDao sysUserDao;

	@Transactional(readOnly = true)
	public SysUser getUserByUid(long userID) {
		return sysUserDao.getUserById(userID);
	}
	
	

	@Transactional(readOnly = true)
	public List<SysUser> getAllUser() {
		return sysUserDao.getUserAll();
	}

	@Transactional(readOnly = false)
	public int insertUser(SysUser user) {
		return sysUserDao.insertUser(user);
	}

	@Transactional(readOnly = false)
	public int updateUser(SysUser user) {
		return sysUserDao.updateUserById(user);
	}

	@Transactional(readOnly = false)
	public int deleteUser(long userID) {
		return sysUserDao.deleteUserById(userID);
	}



	public SysUser getUser(String username, String pwd) {
		return sysUserDao.getUser(username, pwd);
	}
}
